<#assign className = table.className>
<#assign classNameLower = className?uncap_first>
package ${basePackage}.serviceimpl;

import ${basePackage}.dto.${table.classNameLower}.${table.className}FindQueryRequestDto;
import ${basePackage}.dto.${table.classNameLower}.${table.className}InsertRequestDto;
import ${basePackage}.dto.${table.classNameLower}.${table.className}SelectQueryRequestDto;
import ${basePackage}.dto.${table.classNameLower}.${table.className}UpdateRequestDto;
import ${basePackage}.dto.${table.classNameLower}.${table.className}FindQueryResponseDto;
import ${basePackage}.dto.${table.classNameLower}.${table.className}SelectQueryResponseDto;
import ${basePackage}.dto.${table.classNameLower}.${table.className}DeleteRequestDto;
import ${basePackage}.entity.${table.className};

import ${basePackage}.service.${table.className}Service;
import ${basePackage}.dao.${table.className}Dao;
import ${basePackage}.converter.${table.className}Converter;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * ${table.remark} 服务层实现
 * </p>
 *
 * @author wangjin
 * @classname: ${className}
 * @description: ${table.remark} 服务层实现
 * @towork: none
 * @version: 1.0.0
 * @since ${.now?string('yyyy/MM/dd HH:mm')}
 */
@Service
public class ${table.className}ServiceImpl implements ${table.className}Service{

    /**
     * ${table.remark}持久层
     */
    @Resource
    private ${table.className}Dao ${classNameLower}Dao;

    /**
     * ${table.remark} 转换器
     */
    @Resource
    private ${table.className}Converter ${classNameLower}Converter;

    /**
     * ${table.remark} 列表查询
     *
     * @param ${table.className?uncap_first}SelectQueryRequestDto ${table.remark} 服务层查询请求封装对象
     * @return ${table.className}SelectQueryResponseDto集合
     */
    @Override
    public List<${table.className}SelectQueryResponseDto> selectList(${table.className}SelectQueryRequestDto ${table.className?uncap_first}SelectQueryRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.selectQueryRequestDtoToDo(${table.className?uncap_first}SelectQueryRequestDto);

        //执行逻辑
        List<${table.className}> ${table.className?uncap_first}List =  ${classNameLower}Dao.selectList(${table.className?uncap_first});

        //将结果集转换成dto并输出到控制器层
        return ${classNameLower}Converter.selectQueryResponseDoToDto(${table.className?uncap_first}List);
    }

    /**
     * ${table.remark} 根据唯一索引查询  findQueryResponseDtoToVo
     *
     * @param ${table.className?uncap_first}FindQueryRequestDto ${table.remark} 服务层查询请求封装对象
     * @return ${table.className}FindQueryResponseDto
     */
    @Override
    public ${table.className}FindQueryResponseDto findByUniqueKey(${table.className}FindQueryRequestDto ${table.className?uncap_first}FindQueryRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.findQueryRequestDtoToDo(${table.className?uncap_first}FindQueryRequestDto);

        //执行逻辑
        ${table.className} ${table.className?uncap_first}New =  ${classNameLower}Dao.findByUniqueKey(${table.className?uncap_first});

        //将结果集转换成dto并输出到控制器层
        return ${classNameLower}Converter.findQueryResponseDoToDto(${table.className?uncap_first}New);
    }

    /**
     * ${table.remark} 根据主键查询数据
     *
     * @param ${table.className?uncap_first}FindQueryRequestDto ${table.remark} 服务层查询请求封装对象
     * @return ${table.className}FindQueryResponseDto
     */
    @Override
    public ${table.className}FindQueryResponseDto findByPrimaryKey(${table.className}FindQueryRequestDto ${table.className?uncap_first}FindQueryRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.findQueryRequestDtoToDo(${table.className?uncap_first}FindQueryRequestDto);

        //执行逻辑
        ${table.className} ${table.className?uncap_first}New =  ${classNameLower}Dao.findByPrimaryKey(${table.className?uncap_first});

        //将结果集转换成dto并输出到控制器层
        return ${classNameLower}Converter.findQueryResponseDoToDto(${table.className?uncap_first}New);
    }

    /**
     * ${table.remark} 新增
     *
     * @param ${table.className?uncap_first}InsertRequestDto ${table.remark} 服务层插入请求封装对象
     * @return 受影响行数
     */
    @Override
    public int insert(${table.className}InsertRequestDto ${table.className?uncap_first}InsertRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.insertRequestDtoToDo(${table.className?uncap_first}InsertRequestDto);

        //执行逻辑并返回结果
        return ${classNameLower}Dao.insert(${table.className?uncap_first});
    }

    /**
     * ${table.remark} 根据主键更新
     *
     * @param ${table.className?uncap_first}UpdateRequestDto
     * @return 受影响行数
     */
    @Override
    public int updateByPrimaryKey(${table.className}UpdateRequestDto ${table.className?uncap_first}UpdateRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.updateRequestDtoToDo(${table.className?uncap_first}UpdateRequestDto);

        //执行逻辑并返回结果
        return ${classNameLower}Dao.updateByPrimaryKey(${table.className?uncap_first});
    }

    /**
     * ${table.remark} 根据条件更新
     *
     * @param ${table.className?uncap_first}UpdateRequestDto ${table.remark} 服务层更新请求封装对象
     * @return 受影响行数
     */
    @Override
   public int updateByCondition(${table.className}UpdateRequestDto ${table.className?uncap_first}UpdateRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.updateRequestDtoToDo(${table.className?uncap_first}UpdateRequestDto);

        //执行逻辑并返回结果
        return ${classNameLower}Dao.updateByCondition(${table.className?uncap_first});
    }

    /**
     * ${table.remark} 根据主键删除数据
     *
     * @param ${table.className?uncap_first}DeleteRequestDto ${table.remark}实体类
     * @return 受影响行数
     */
    @Override
    public int delete(${table.className}DeleteRequestDto ${table.className?uncap_first}DeleteRequestDto){
        //dto转换成do
        ${table.className} ${table.className?uncap_first} =  ${classNameLower}Converter.deleteRequestDtoToDo(${table.className?uncap_first}DeleteRequestDto);

        //执行逻辑并返回结果
        return ${classNameLower}Dao.delete(${table.className?uncap_first});
     }

    /**
     * ${table.remark} 根据主键批量删除数据
     *
     * @param ${table.className?uncap_first}DeleteRequestDtoList ${table.remark}实体类
     * @return 受影响行数
     */
    @Override
    public int deleteByBatch( List<${table.className}DeleteRequestDto> ${table.className?uncap_first}DeleteRequestDtoList){
        //dto转换成do
        List<${table.className}> ${table.className?uncap_first}List =  ${classNameLower}Converter.deleteRequestDtoToDoByBatch(${table.className?uncap_first}DeleteRequestDtoList);

        //执行逻辑并返回结果
        return ${classNameLower}Dao.deleteByBatch(${table.className?uncap_first}List);
    }
}
